<?php
/**
 * Created by PhpStorm.
 * User: Sing
 * Date: 16/9/27
 * Time: 11:08
 * Soap 服务,统一调用
 */

require '../Lib/Sing_core.php';

ini_set("display_errors","On");//开启错误显示

$mid = $_mid = $_GET['mid'];// = C::t('#weixin#user')->getMid($AppId);
if(empty($mid)) exit('Mid Error');
@include libfile('function/api');

//验证Mid正确性
$uid = C::t('#api#user')->getUid($mid);

$server = new SoapServer(null, array('uri' => "sichem.cn/soap"));
$server->addFunction("SoapClass");
$server->handle();

function SoapClass($className,$fname,$args){
    $className = 'api_'.$className;
    //初始化访客信息
    //inituser($_GET['mid']);
    return 'Server is Ok   '.$_SERVER['HTTP_USER_AGENT'];
    $Class = new $className();
    $func = method_exists($Class, $fname);
    if ($func) {
        return   $Class->$fname($args);
    }
}